﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <div>
         <table class="easyui-datagrid" id="bookinglist" data-options="rownumbers:true">
        </table>
    </div>
     <script type="text/javascript">
         $('#bookinglist').datagrid({
             url: '../admin/Getbookinglist',
             singleSelect: true,
             columns: [[
              { field: 'name', title: '姓名', width: 50 },
              { field: 'email', title: '邮箱', width: 100 },
              { field: 'phone', title: '电话', width: 100 },
              { field: 'title', title: '房间', width: 70 },
              { field: 'time', title: '时间', width: 100 },
              { field: 'context', title: '备注', width: 100 },
              { field: 'is_chack', title: '是否已确定', width: 60},
              { field: 'chekin', title: '是否已入住', width: 60 },
              {
                  field: 'chekin1', title: '入住', width: 60, align: 'center',
                  formatter: function (value, rec) {
                      var btn = "<a href=" + "#" + " class=" + "easyui-linkbutton" + " iconcls=" + "icon-edit" + " onclick=" + "opt(" + rec.id + ",1)" + " plain=" + "true" + ">入住</a>";
                      return btn;
                  }
              },
              {
                  field: 'is_cheack', title: '确认', width: 60, align: 'center',
                  formatter: function (value, rec) {
                      var btn = "<a href=" + "#" + " class=" + "easyui-linkbutton" + " iconcls=" + "icon-edit" + " onclick=" + "opt(" + rec.id + ",2)" + " plain=" + "true" + ">确认</a>";
                      return btn;
                  }
              }
              ,
              {
                  field: 'deldetd', title: '删除', width:60, align: 'center',
                  formatter: function (value, rec) {
                      var btn = "<a href=" + "#" + " class=" + "easyui-linkbutton" + " iconcls=" + "icon-edit" + " onclick=" + "opt(" + rec.id + ",3)" + " plain=" + "true" + ">删除</a>";
                      return btn;
                  }
              }
             ]]
         });
         function opt(rec, op) {


             $.post("../admin/Optbooking", { ID: rec, OP: op },
              function (data) {
                  if (data == false) {
                      $.messager.alert('未知错误', '操作失败.');
                  }
                  else {
                      $.messager.alert('提示', '操作成功');
                      $('#bookinglist').datagrid('load', {
                          code: '01',
                          name: 'name'
                      });
                  }
              });
         }
    </script>
</body>
</html>
